/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.hk.shop.service.category;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.service.TreeService;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.modules.hk.shop.entity.category.HkShopCategory;
import com.thinkgem.jeesite.modules.hk.shop.dao.category.HkShopCategoryDao;

/**
 * 商品分类Service
 *
 * @author 罗天文
 * @version 2018-05-15
 */
@Service
@Transactional(readOnly = true)
public class HkShopCategoryService extends TreeService<HkShopCategoryDao, HkShopCategory> {

    public HkShopCategory get(String id) {
        return super.get(id);
    }

    public List<HkShopCategory> findList(HkShopCategory hkShopCategory) {
        if (StringUtils.isNotBlank(hkShopCategory.getParentIds())) {
            hkShopCategory.setParentIds("," + hkShopCategory.getParentIds() + ",");
        }
        return super.findList(hkShopCategory);
    }


    public List<HkShopCategory> findMerchList(HkShopCategory hkShopCategory) {
        if (StringUtils.isNotBlank(hkShopCategory.getParentIds())) {
            hkShopCategory.setParentIds("," + hkShopCategory.getParentIds() + ",");
        }
        return dao.findMerchList(hkShopCategory);
    }

    @Transactional(readOnly = false)
    public void save(HkShopCategory hkShopCategory) {
        super.save(hkShopCategory);
    }

    @Transactional(readOnly = false)
    public void delete(HkShopCategory hkShopCategory) {
        super.delete(hkShopCategory);
    }

}